<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

jimport( 'joomla.application.component.view' );

/**
 * @package Joomla
 * @subpackage JobBoard
 */
class JobBoardViewJAPosts extends JView 
{
    /**
     * Display the view
     */
    function display($tmpl = null)
    {
		switch ($this->getLayout()){
			case 'buycredit':{			
				JobBoardViewJAPosts::show_form_buycredit();
			}break;							
				
			default:{
				JRequest::setVar('layout', 'selectplan');				
				JobBoardViewJAPosts::show_select_plan();
			}
		}
		
		parent::display($tmpl);
  	}
  	
  	
  	/**
  	* Display List of items
  	*/
  	function show_select_plan(){
  		global $jbconfig, $mainframe,$option;
  		
  		$tab = JRequest::getVar('tab', 1);
  		$this->assignRef('tab', $tab);
  		
  		if($tab==3 && $jbconfig['currency']->get('mode')!='special_currency'){
  			JResponse::setHeader('HTTP/1.0 403',true);
	        JError::raiseWarning( 1, JText::_('Sorry, currently our system does not support using credit') );
	        echo '<br /><a class="button" href="#" onclick="window.history.go(-1);">'.JText::_('Back').'</a>';
			return $mainframe->redirect(JRoute::_("index.php?option=$option&view=jaerrors&Itemid=1000"));
  		}
  		
  		$types = JobBoardConstant::getPostingPlan_Type();
  		$this->assignRef('types', $types);
  		
  		$list = &$this->get('Items');
        $this->assignRef('list', $list);
                
        $package_credits = $this->get('Package_credits');		
		$this->assign('package_credits', $package_credits); 
  	}
  	
  	/**
  	* Display  Form buy credit
  	*/
  	function show_form_buycredit(){  	    
  		global $jbconfig, $mainframe,$option;
  		
		if($jbconfig['currency']->get('mode')!='special_currency'){
			JResponse::setHeader('HTTP/1.0 403',true);
	        JError::raiseWarning( 1, JText::_('Sorry, currently our system does not support using credit') );
	        echo '<br /><a class="button" href="#" onclick="window.history.go(-1);">'.JText::_('Back').'</a>';
			return ""; //$mainframe->redirect(JRoute::_("index.php?option=$option&view=jaerrors&Itemid=1000"));
		}
  		$pays_sys = get_payment_gateways();		
		$paysys = JHTML::_('select.genericlist',   $pays_sys, 'payment_method', 'class="inputbox" size="1"', 'id', 'alias', $jbconfig['billing']->get('ja_default_pay_meth'));
		$this->assign('paysys', $paysys); 
		
		$package_credits = $this->get('Package_credits');		
		$this->assign('package_credits', $package_credits); 
	}
	
}
?>